﻿<Window x:Class="WpfTestApplication.MainWindow"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:SE="clr-namespace:WpfShaderEffects;assembly=WpfShaderEffects"
    Title="MainWindow" MinHeight="600" MinWidth="800">
   <Window.Resources>
      <Storyboard x:Key="RippleStoryBoard" RepeatBehavior="Forever">
         <DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="RippleImage" Storyboard.TargetProperty="(UIElement.Effect).(SE:RippleShaderEffect.Phase)">
            <SplineDoubleKeyFrame KeyTime="00:00:02" Value="3.14159265358979" KeySpline="0.79,0.21,0.4,0.75"/>
            <SplineDoubleKeyFrame KeyTime="00:00:04" Value="6.28318530717959" KeySpline="0.79,0.21,0.4,0.75"/>
         </DoubleAnimationUsingKeyFrames>
      </Storyboard>
      <Storyboard x:Key="TransitionStoryBoard" RepeatBehavior="Forever">
         <DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="Transition" Storyboard.TargetProperty="Mix">
            <SplineDoubleKeyFrame KeyTime="00:00:00" Value="0.0"/>
            <SplineDoubleKeyFrame KeyTime="00:00:01" Value="1.0"/>
            <SplineDoubleKeyFrame KeyTime="00:00:02" Value="1.0"/>
            <SplineDoubleKeyFrame KeyTime="00:00:03" Value="0.0"/>
            <SplineDoubleKeyFrame KeyTime="00:00:04" Value="0.0"/>
         </DoubleAnimationUsingKeyFrames>
      </Storyboard>
   </Window.Resources>
   <Window.Triggers>
      <EventTrigger RoutedEvent="FrameworkElement.Loaded">
         <BeginStoryboard Storyboard="{StaticResource RippleStoryBoard}"/>
         <BeginStoryboard Storyboard="{StaticResource TransitionStoryBoard}"/>
      </EventTrigger>
   </Window.Triggers>
   <Grid>
      <Grid.ColumnDefinitions>
         <ColumnDefinition Width="0.5*"/>
         <ColumnDefinition Width="0.5*"/>
      </Grid.ColumnDefinitions>
      <Grid.RowDefinitions>
         <RowDefinition Height="0.5*"/>
         <RowDefinition Height="0.5*"/>
      </Grid.RowDefinitions>
      <Grid Grid.Column="0" Grid.Row="0">
         <Image Source="/WpfTestApplication;component/Images/Tulips.jpg" Stretch="UniformToFill"/>
         <TextBlock FontSize="24" HorizontalAlignment="Center" VerticalAlignment="Center">Normal</TextBlock>
      </Grid>
      <Grid Grid.Column="0" Grid.Row="1">
         <Image Source="/WpfTestApplication;component/Images/Tulips.jpg" Stretch="UniformToFill">
            <Image.Effect>
               <SE:InvertColorShaderEffect />                  

            </Image.Effect>
         </Image>
         <TextBlock FontSize="24" HorizontalAlignment="Center" VerticalAlignment="Center">Invert</TextBlock>
      </Grid>
      <Grid Grid.Column="1" Grid.Row="0">
         <Image Name="RippleImage" Source="/WpfTestApplication;component/Images/Tulips.jpg" Stretch="UniformToFill">
            <Image.Effect>
               <SE:RippleShaderEffect 
                  Center="0.3,0.3" 
                  Amplitude="1" 
                  Frequency="5" 
                  Phase="0"  />

            </Image.Effect>
         </Image>
         <TextBlock FontSize="24" HorizontalAlignment="Center" VerticalAlignment="Center">Ripple</TextBlock>
      </Grid>
      <Grid Grid.Column="1" Grid.Row="1">
         <SE:TransitionEffectMixer Name="Transition">
            <SE:TransitionEffectMixer.Left>
               <Image Source="/WpfTestApplication;component/Images/Tulips.jpg" Stretch="UniformToFill"/>
            </SE:TransitionEffectMixer.Left>
            <SE:TransitionEffectMixer.Right>
               <Image Source="/WpfTestApplication;component/Images/Chrysanthemum.jpg" Stretch="UniformToFill"/>
            </SE:TransitionEffectMixer.Right>
            <SE:TransitionEffectMixer.TransitionShaderEffect>
               <SE:WaveTransitionShaderEffect/>
            </SE:TransitionEffectMixer.TransitionShaderEffect>
         </SE:TransitionEffectMixer>
         <TextBlock FontSize="24" HorizontalAlignment="Center" VerticalAlignment="Center">Transition</TextBlock>
      </Grid>

   </Grid>
</Window>
